package com.woniuxy.entity;


import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @BelongsProject: java-85-course-code
 * @BelongsPackage: com.woniuxy.entity
 * @Author: LiTongMiao
 * @Date: 2022/2/10 10:51
 * @Description: TODO
 */
public class ManagerUser {
    @NotEmpty(message = "姓名不能为空")
    @Length(min = 1,max = 18,message = "名字需要在1-18范围")
    private String name;

    @NotBlank(message = "电话号码不能为空")
    @Pattern(regexp = "^134[0-8]\\\\d{7}$|^13[^4]\\\\d{8}$|^14[5-9]\\\\d{8}$|^15[^4]\\\\d{8}$|^16[6]\\\\d{8}$|^17[0-8]\\\\d{8}$|^18[\\\\d]{9}$|^19[8,9]\\\\d{8}$",message = "电话格式不正确")
    private String phone;

    @Email(message = "邮箱格式不正确")
    private String email;

    @Valid
    @NotNull(message = "不能没有食物")
    private Food food;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Food getFood() {
        return food;
    }

    public void setFood(Food food) {
        this.food = food;
    }

    @Override
    public String toString() {
        return "ManagerUser{" +
                "name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", email='" + email + '\'' +
                ", food=" + food +
                '}';
    }
}
